<template>
  <div class="mavic-series">
    <div class="photo">御 Mavic 系列</div>
    <div class="title">御 Mavic</div>
    <!-- <el-button type="danger" icon="el-icon-delete" circle></el-button> -->
    <!-- 系列产品内容star -->
    <div class="product-list">
      <!-- 主打产品内容 -->
      <div class="product-top-detail">
        <!-- 头部样式 -->
        <div class="product-top-detail-left" @click="goToTopUrl">
          <div class="product-pic">
            <img :src="goodsList[0].s_goods_photos[0].path" alt="" />
          </div>
          <div class="product-text">
            <h1>{{ goodsList[0].name }}</h1>
            <h2>{{ goodsList[0].desc }}</h2>
            <h3>￥{{ goodsList[0].price }}</h3>
          </div>
        </div>
        <div class="product-top-detail-right"></div>
      </div>
      <div class="prodduct-goods">
        <div
          class="prodduct-goods-item"
          v-for="item in sonGoodsList"
          :key="item.id"
          @click="goTOUrl(item.id)"
        >
          <div class="product-pic">
            <img :src="item.s_goods_photos[0].path" alt="" />
          </div>
          <div class="product-text">
            <h1>{{ item.name }}</h1>
            <h2>{{ item.desc }}</h2>
            <h3>￥{{ item.price }}</h3>
          </div>
        </div>
      </div>
    </div>
    <!-- 系列产品内容end -->
    <div>
      <showProductList
        :msg="partsList"
        :title="'配件'"
        :canshow="false"
      ></showProductList>
    </div>
  </div>
</template>

<script>
import showProductList from "@/components/homeComponent/showProductList.vue";
import { getGoods } from "@/assets/tool/request.js";
// import shopPageProductList from '@components/shoppage/shopPageProductList.vue'
export default {
  data() {
    return {
      goodsList: {},
      sonGoodsList: {},
      partsList: {},
    };
  },
  components: {
    showProductList: showProductList,
  },
  methods: {
    getres(goodsId, projectid) {
      let res = getGoods({
        page: 1,
        limit: 5,
        project_id: projectid,
        classify_id: goodsId,
      });
      return res;
    },
    goToTopUrl() {
      this.$router.push(`/product/${this.goodsList[0].id}`);
    },
    goTOUrl(id) {
      this.$router.push(`/product/${id}`);
    },
  },

  async created() {
    let res = await this.getres(380, 104);
    this.goodsList = res.data.result.rows.reverse();
    // console.log(this.goodsList);
    this.sonGoodsList = this.goodsList.slice(1, 5);
    // console.log(this.sonGoodsList, 112312321);
    this.partsList = await this.getres(428, 131);
    // this.partsList = res2.console.log(this.partsList);
  },
};
</script>

<style lang="scss" scoped>
// 标签图
.photo {
  background-image: url("https://stormsend1.djicdn.com/stormsend/uploads/c23675197790afff3b88d4e495564959.jpg");
  background-size: cover;
  background-position: center;
  height: 480px;
  font-size: 40px;
  color: #fff;
  text-align: center;
  line-height: 480px;
}
// 标题样式
.title {
  width: 1200px;
  margin: 50px auto 0;
  height: 48px;
  font-size: 32px;
  font-weight: 550;
  margin-bottom: 16px;
}
.product-top-detail {
  width: 1200px;
  margin: 0 auto;
  display: flex;
  .product-top-detail-left {
    flex: 1;
    display: flex;
    align-items: center;
    height: 400px;
    background-color: #fff;
     &:hover {
      cursor: pointer;
    }
  }
  .product-top-detail-right {
    flex: 1;
    background-image: url("https://stormsend1.djicdn.com/stormsend/uploads/7eee707c651188e79c18eba78c316abf.jpg");
    background-size: cover;
  }
}
.prodduct-goods {
  width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .prodduct-goods-item {
    height: 330px;
    margin-top: 10px;
    background-color: #fff;
    width: 49.5%;
    display: flex;
    align-items: center;
     &:hover {
      cursor: pointer;
    }
  }
}

.product-pic {
  flex: 1;
  margin: 0 24px;
  text-align: center;
  img {
    width: 90%;
  }
}
.product-text {
  flex: 1;
  margin: 0 24px;
  h1 {
    font-size: 24px;
    margin-bottom: 16px;
    line-height: 32px;
  }
  h2 {
    font-size: 14px;
    line-height: 24px;
    margin-bottom: 24px;
  }
  h3 {
    font-size: 16px;
    line-height: 20px;
  }
}
</style>